package com.saguitech.sgemeos.utils;

import java.util.List;

import android.app.AlertDialog;
import android.content.Context;

import com.saguitech.sgemeos.business.ExpositionBusiness;
import com.saguitech.sgemeos.business.ParticipantBusiness;
import com.saguitech.sgemeos.services.ExpositionsService;
import com.saguitech.sgemeos.services.FacadeService;
import com.saguitech.sgemeos.services.ParticipationService;

public class Test {
	
	FacadeService facade;
	Context context;
	ExpositionsService expositionservice;
	ParticipationService participantservice;
	
	public Test(Context c, FacadeService f){
		this.facade = f;
		this.context = c;
		this.expositionservice = new ExpositionsService();
		this.participantservice = new ParticipationService();
	}
	
	public void testGetAllExpositions(){
		List<ExpositionBusiness> list = expositionservice.getAllExpositions();
		for(ExpositionBusiness expo : list){
			AlertDialog alertDialog;
			alertDialog = new AlertDialog.Builder(context).create();
			alertDialog.setTitle("Expo");
			String s = "Titulo: " + expo.getTitle() +
			"\nTipo: " + expo.getType() + 
			"\nVagas: " + expo.getVacancies() +
			"\nLocal: " + expo.getLocation().getAddress()+
			"\nHora: " + (expo.getTimeList() != null ? expo.getTimeList().get(0).getInitialTime() : "--");
			alertDialog.setMessage(s);
			alertDialog.show();
		}
	}
	
	public void testGetParticipant(int id){
		ParticipantBusiness participant = participantservice.getParticipant(id);
		
			AlertDialog alertDialog;
			alertDialog = new AlertDialog.Builder(context).create();
			alertDialog.setTitle("Paticipante");
			String s = "Nome: " + participant.getName() +
			"\nCPF: " + participant.getCpf();
			alertDialog.setMessage(s);
			alertDialog.show();
		
	}
	
	public void testGetParticipantLogin(String login){
		ParticipantBusiness participant = participantservice.getParticipantLogin(login);
		
			AlertDialog alertDialog;
			alertDialog = new AlertDialog.Builder(context).create();
			alertDialog.setTitle("Paticipante");
			String s = "Nome: " + participant.getName() +
			"\nCPF: " + participant.getCpf();
			alertDialog.setMessage(s);
			alertDialog.show();
		
	}
}
